<?php
require dirname(__FILE__) . '/checkuser.php';
require dirname(dirname(__FILE__)) . '/include/conf.php';

$re = 'fail';
$msg = '参数错误，设置失败';
$set_file = dirname(dirname(__FILE__)) . '/include/fcsetfile.txt';

if ($_SERVER['REQUEST_METHOD'] == 'POST'){
	if (isset($_POST['set']) && ($_POST['set'] == 'start' || $_POST['set'] == 'stop')){
		$re = conf_switch_sets('set', $_POST['set']);
		if ($re === false){
			$msg = '设置失败，请重试，不行找小黑';
		}else {
			$re = 'succ';
			$msg = $_POST['set'] == 'start' ? '设置成功，已经开始抓取' : '已经停止抓取';
		}
	}
}

$result = array(
	're' => $re,
	'msg' => $msg
);
exit(json_encode($result));
